<template>
  <div></div>
</template>

<script>
export default {
  data () {
    return {
      userID: 'user001'
    }
  },
  methods: {
    login () {
      this.tim
        .login({
          userID: this.userID,
          userSig: window.genTestUserSig(this.userID).userSig
        })
        .then(() => {
          this.loading = false
          this.$store.commit('toggleIsLogin', true)
          this.$store.commit('startComputeCurrent')
          this.$store.commit('showMessage', { type: 'success', message: '登录成功' })
          this.$store.commit({
            type: 'GET_USER_INFO',
            userID: this.form.userID,
            userSig: window.genTestUserSig(this.form.userID).userSig,
            sdkAppID: window.genTestUserSig('').SDKAppID
          })
          this.$store.commit('showMessage', {
            type: 'success',
            message: '登录成功'
          })
        })
        .catch(error => {
          this.loading = false
          this.$store.commit('showMessage', {
            message: '登录失败：' + error.message,
            type: 'error'
          })
        })
    }
  },
  mounted () {
    this.login()
  }
}

</script>

<style>
</style>
